package com.qf.service.impl;

import com.codingapi.txlcn.tc.annotation.LcnTransaction;
import com.qf.mapper.UserMapper;
import com.qf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.client.RestTemplate;

/**
 * @author 千锋教育
 * @Company http://www.mobiletrain.org/
 * @Version 1.0
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    UserMapper userMapper;


    @Autowired
    RestTemplate restTemplate;

    @Override
    @Transactional
    @LcnTransaction
    public void transfer() {
        // 加钱
        userMapper.update();


        //需要进行远程调用 执行 减钱

        restTemplate.getForEntity("http://localhost:8082/transfer", String.class);
    }
}
